home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 40
/
040.d81
/
pixel puzzler
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
6KB
|
239 lines
10 ifx>.then100
20 poke53280,1:poke53281,1
30 printchr$(142)"[147] gathering the pieces to the puzzle..."
100 ifx=0thenx=1:load"text.3.o",8,1
120 ifx=1thenx=2:load"ram.lnk",8,1
130 ifx=2thenx=3:load"unpacker",8,1
140 ifx=3thenx=4:load"hand.spr",8,1
150 :
160 ni=42 : rem number of items 6*7
170 na=6 : rem number across
180 nd=6 : rem number down-1
182 v=53248:rem vic
190 :
200 poke249,224:poke250,204:dima%(ni)
210 sys51459:poke53280,2: rem show screen
220 poke828,0:poke829,39:poke830,0:poke831,24:sys49152:sys49158,22
230 :
235 pokev+21,0
240 sys49161,"[208][201][195][203] [217][207][213][210] [205][207][196][197]",13,5,0
250 sys49161,"--------------",13,6,0
260 sys49161,"1 ==> [215][201][206][206][197][210]",12,8,0
270 sys49161,"2 ==> [201][206][212][197][210][205][197][196][201][193][212][197]",12,10,0
275 sys49161,"3 ==> [204][207][211][197][210]",12,12,0
280 sys49161,"4 ==> [210][197][212][213][210][206] [212][207] [204][207][193][196][211][212][193][210]",12,14,0
290 poke198,0:wait198,1:getmo$:mo=val(mo$):ifmo>=1andmo<=4then320
300 sys49167,1000,33,15,15:fordl=1to1000:next
310 sys49167,1000,32,0,0:goto290
320 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
330 ifmo=1thenforx=1toni:a%(x)=x:next:cf=1:goto510
340 ifmo=4then1020
350 gosub 1680
355 gosub 4000 : rem show picture
360 :
370 sys49161,"[208][210][197][211][211] '[200]' [198][207][210] [200][197][204][208]",11,23,1
372 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,1,1
380 :
390 :
400 :
410 cf=0
420 poke1016+52224,24:pokev+39,5:pokev,60:pokev+1,68
430 pokev+29,0:pokev+23,0:pokev+16,0
440 pokev+21,1
450 :
460 ifgip=1then510
470 forx=1toni:a%(x)=x:next
480 forx=1toni:r1=rnd(1)*ni+1:r2=rnd(1)*ni+1:t=a%(r1):a%(r1)=a%(r2)
490 a%(r2)=t:next
495 ro=0:co=1
500 :
510 gosub 3300 : rem plot them puppies
600 :
610 fl=0
620 forx=0toni-1
630 ifa%(x+1)<>x+1thenfl=1
640 ifa%(x+1)=nithenbl=x
650 next
660 :
670 ifcf=1then1530
680 iffl=0thensys49161," [217][207][213] [215][207][206]!! ",1,0,0:goto1450
690 j=56320
700 gosub 1080
710 a=co+ro*na
720 br=int(bl/na):bc=bl-na*br:bc=bc+1
730 ifmo=2anda%(a)<>nithen1600 : rem plop it
740 if(br<>roandbc<>co)ora%(a)=nithen970
750 ifbr<>rothen870
760 if bc>cothenb=bc:e=co+1:i=-1
770 if bc<cothenb=bc:e=co-1:i=1
780 forx=btoestepi
790 t=ro*na+x:f=ro*na+x+i
800 a%(t)=a%(f)
810 poke254,2+ro*3:poke253,x*5:poke255,a%(t)-1:sys51462
820 poke254,2+ro*3:poke253,(x+i)*5:poke255,ni-1:sys51462
830 next
840 ag=3.34:a%(ro*na+x)=ni
850 goto 610
860 :
870 ifbc<>cothen960
880 ifbr>rothenb=br:e=ro+1:i=-1
890 ifbr<rothenb=br:e=ro-1:i=1
900 forx=btoestepi
910 t=x*na+co:f=(x+i)*na+co:a%(t)=a%(f)
920 poke253,co*5:poke254,2+x*3:poke255,a%(t)-1:sys51462
930 poke253,co*5:poke254,2+(x+i)*3:poke255,ni-1:sys51462
940 ag=3.34:next
950 a%(x*na+co)=ni:goto610
960 :
970 sys49161," [201][204][204][197][199][193][204] [205][207][214][197] ",1,0,0:sys49167,1000,33,15,15
980 fordl=1to500:next:sys49167,0,32,0,0
990 sys49161," ",13,0,0
1000 goto 700
1010 :
1020 pokev+21,0:pokev+16,0:print"[147]":sys51459
1030 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
1040 ifer<>63thenend
1050 load"hello connect",8
1060 end
1070 :
1080 rem read keyboard and joystick
1090 ifpeek(198)=0andpeek(j)=127then1090
1100 geta$:js=peek(j):ifjs=111ora$=chr$(13)thenreturn
1110 cf=0:ifa$="w"thenforx=1toni:a%(x)=x:next:cf=1:goto510
1115 ifa$="h"thengosub3000:sys49161,"[208][210][197][211][211] '[200]' [198][207][210] [200][197][204][208]",11,23,1:goto510
1120 ifa$="m"thengosub1320:goto1090
1130 ifa$="s"thengosub1980:goto1090
1135 ifa$="v"thenpokev+21,.:gosub4000:pokev+21,1:goto1090
1140 ifa$=""orjs=119thenco=co+1
1150 ifa$="[157]"orjs=123thenco=co-1
1160 ifa$=""orjs=125thenro=ro+1
1170 ifa$="[145]"orjs=126thenro=ro-1
1180 ifjs=118thenco=co+1:ro=ro-1
1190 ifjs=117thenco=co+1:ro=ro+1
1200 ifjs=121thenco=co-1:ro=ro+1
1210 ifjs=122thenco=co-1:ro=ro-1
1220 :
1230 ifco<1thenco=1
1240 ifro<0thenro=0
1250 ifro>ndthenro=nd
1260 ifco>nathenco=na
1270 :
1280 pokev,21+co*39:pokev+1,68+ro*24:pokev+16,0
1290 goto1090
1300 :
1310 :
1320 rem quit
1330 sys49161," [196][207] [217][207][213] [215][193][206][212] [212][207] [209][213][201][212] [212][200][201][211] [208][213][218][218][204][197]? ",1,0,0
1340 forx=1to100:ifpeek(198)=0thennextx
1350 ifpeek(198)<>0then1410
1360 sys49161," ",4,0,0
1370 fory=1to100:ifpeek(198)=0thennexty
1380 ifpeek(198)<>0then1410
1390 goto1330
1400 :
1410 geta$
1420 ifa$<>"y"thensys49161," ",4,0,0:return
1430 :
1440 goto220
1445 :
1450 rem win
1460 poke253,na*5:poke254,2+nd*3:poke255,ni:sys51462:ag=3.34
1470 forx=1000to20000step500:sys49167,x,33,15,15:next
1480 forx=1000to20000step500:sys49167,x,33,15,15:next
1490 forx=1000to20000step500:sys49167,x,33,15,15:next
1500 sys49167,0,32,0,0
1510 fordl=1to100:nextdl
1520 :
1530 poke253,na*5:poke254,2+nd*3:poke255,ni:sys51462:ag=3.34
1540 sys49161," [196][207] [217][207][213] [215][193][206][212] [212][207] [208][204][193][217] [193][199][193][201][206]? ",1,0,0
1550 poke198,0:wait198,1
1560 geta$:ifa$="y"then220
1570 ifa$<>"n"then1550
1580 goto1020
1590 :
1600 rem plop it
1610 ifa%(a)=nithen870
1620 t=a%(a):a%(a)=a%(bl+1):a%(bl+1)=t
1630 poke254,2+ro*3:poke253,co*5
1640 poke255,ni-1:sys51462:ag=3.34
1650 poke254,2+br*3:poke253,bc*5
1660 poke255,t-1:sys51462:ag=3.34
1670 goto610
1680 rem game in progress
1690 gip=0:pokev+21,0
1700 sys49161,"[215][207][213][204][196] [217][207][213] [204][201][203][197] [212][207] [204][207][193][196] [193]",10,10,0
1710 sys49161,"[199][193][205][197] [201][206] [208][210][207][199][210][197][211][211]?",10,12,0
1720 poke198,0:wait198,1:geta$:ifa$<>"y"then1790
1730 :
1740 f$="pp.gip"
1750 gip=1
1760 open2,8,2,f$
1770 forx=1toni:input#2,a%(x):next
1780 close2
1790 pokev+21,1:return
1970 :
1980 rem save gip
1990 rem
2000 sys49161," [211][193][214][201][206][199] [199][193][205][197] [201][206] [208][210][207][199][210][197][211][211]... ",1,1,0
2010 open15,8,15,"i0":print#15,"s0:pp.gip":close15
2020 :
2030 f$="0:pp.gip,s,w"
2040 open2,8,2,f$
2050 forx=1toni
2060 print#2,a%(x)
2070 next
2080 close2
2090 sys49161," ",1,1,0
2092 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,1,1
2100 return
3000 rem help
3010 pokev+21,0
3015 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
3020 sys49161,"[208][201][216][197][204] [208][213][218][218][204][197][210]",13,3,0
3030 sys49161,"[212][207] [205][207][214][197] [212][200][197] [200][193][206][196], [213][211][197] [212][200][197] [195][213][210][211][207][210]",4,5,0
3040 sys49161,"[203][197][217][211] [207][210] [212][200][197] [202][207][217][211][212][201][195][203] ([201][206] [208][207][210][212] 2).",2,6,0
3050 sys49161,"[215][200][197][206] [212][200][197] [200][193][206][196] [201][211] [207][206] [212][200][197] [208][201][197][195][197]",4,8,0
3060 sys49161,"[217][207][213] [215][201][211][200] [212][207] [205][207][214][197], [208][210][197][211][211] [210][197][212][213][210][206] [207][210]",2,9,0
3062 sys49161,"[212][200][197] [198][201][210][197][194][213][212][212][207][206].",2,10,0
3080 sys49161,"[212][207] [211][193][214][197] [193] [199][193][205][197], [208][210][197][211][211] '[211]'",2,12,0
3090 sys49161,"[212][207] [199][197][212] [212][207] [212][200][197] [205][197][206][213], [208][210][197][211][211] '[205]'",2,14,0
3092 sys49161,"[212][207] [214][201][197][215] [212][200][197] [197][206][212][201][210][197] [208][201][195][212][213][210][197], [208][210][197][211][211] '[214]'",2,16,0
3094 sys49161,"[208][210][197][211][211] [193] [203][197][217] [212][207] [195][207][206][212][201][206][213][197].",7,21,0
3095 :
3100 :
3102 pokev+21,0
3110 poke198,0:wait198,1:poke198,0:pokev+21,1
3120 poke828,1:poke829,38:poke830,1:poke831,23:sys49152:sys49158,1
3125 poke828,1:poke829,38:poke830,1:poke831,23
3130 return
3200 :
3300 rem plot the shapes
3310 xp=1:yp=-1:fl=0
3320 forx=0toni-1
3330 ifa%(x+1)<>x+1thenfl=1
3340 ifint(x/na)=x/nathenyp=yp+3:xp=1
3350 poke251,0:poke252,64
3360 poke2